package io.kiki.sba.registry.common.model;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class GenericResponse<T> extends Response {

    private static final long serialVersionUID = 1L;

    private T data;


    public GenericResponse<T> fillSucceed(T data) {
        this.setSuccess(true);
        this.setData(data);
        return this;
    }


    public GenericResponse<T> fillFailed(String msg) {
        this.setSuccess(false);
        this.setMessage(msg);
        return this;
    }


    public GenericResponse<T> fillFailData(T data) {
        this.setSuccess(false);
        this.setData(data);
        return this;
    }


    public T getData() {
        return data;
    }


    public GenericResponse<T> setData(T data) {
        this.data = data;
        return this;
    }
}
